package com.hillfly.mybatis.shard.strategy.impl;

import com.hillfly.mybatis.shard.strategy.Strategy;
import org.apache.commons.lang3.StringUtils;

/**
 * 按指定后缀分表
 */
public class DefaultStrategy implements Strategy {

    private String suffix;

    public String getSuffix() {
        return suffix;
    }

    public void setSuffix(String suffix) {
        this.suffix = suffix;
    }

    public DefaultStrategy() {

    }

    public DefaultStrategy(String suffix) {
        this.suffix = suffix;
    }

    @Override
    public String getFinalTableName(String s, Object o) {
        return (StringUtils.isNotEmpty(suffix) ? s + "_" + getSuffix() : s);
    }
}
